package May;

import java.util.*;

public class DAY0524 {
    //整数二进制中1的个数
    public static void main(String[] args) {
        //进行接收
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int n = sc.nextInt();
            //转二进制
            String i = Integer.toBinaryString(n);
            int count = 0;
            for (int j = 0; j < i.length(); j++) {
                if (i.charAt(j) == '1'){
                    count++;
                }
            }
            System.out.println(count);
        }
    }

    //手套
    public int findMinimum(int n, int[] left, int[] right) {
        // write code here
        int count = 0;//总数
        //count计入无效元素，考虑最坏情况，将为0的对称元素也设为0.
        for (int i = 0; i < n; i++) {
            if(left[i]==0){
                count+=right[i];
                right[i]=0;
            }
            if(right[i]==0){
                count+=left[i];
                left[i]=0;
            }
        }
        int a = 0;
        int b = 0;
        for (int i = 0; i < n; i++) {
            a+=left[i];
            b+=right[i];
        }
        //这里为了方便后面做个判断，默认设为 left>right 统一对right做处理。
        if(a<b){
            int[] x = left;
            left = right;
            right = x;
        }
        Arrays.sort(right);//对right排序
        //对 right 数组取值确保有效值都能涵盖，最坏情况right中无0取到right[1]。
        for (int i = n-1; i > 0; i--) {
            if(right[i-1]!=0) count+=right[i];
            else break;
        }
        count++;//从 right 最后一种任意取一个，确保right每种手套都涵盖
        count++;//从 left 里任意取一个
        return count;
    }
}
